package com.abc.recycling.repository;

import com.abc.recycling.model.Collector;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;

@Repository
public interface CollectorRepository extends JpaRepository<Collector, Long> {
    
    /**
     * 根据用户名查找回收员
     */
    Collector findByUsername(String username);
    
    /**
     * 根据手机号查找回收员
     */
    Collector findByPhone(String phone);
    
    /**
     * 根据服务区域查找回收员列表
     */
    List<Collector> findByServiceArea(String serviceArea);
    
    /**
     * 查找在岗的回收员列表
     */
    List<Collector> findByStatus(Integer status);

    Optional<Collector> findByIdAndRole(Long id, String role);
    Collector findByUsernameAndRole(String username, String role);
} 